﻿using commonImportPlugin.Common;
using commonImportPlugin.Config;
using commonImportPlugin.Decrypt;
using ICMS.PluginInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace commonImportPlugin.Factorys
{
    //
    //  抽象工厂
    //
    #region
    /// <summary>
    /// 加解密抽象工厂
    /// </summary>
    public abstract class AbstractDecrypt
    {
        public abstract DecryptCoreF CreateCore<T>(T _config);
    }
    /// <summary>
    /// 加解密工厂类
    /// </summary>
    public abstract class DecryptCoreF
    {
        /// <summary>
        /// 解密操作中心
        /// </summary>
        public abstract List<ICData> DecryptCore(List<ICData> decryptDatas, out int succeedCounts);
    }
    #endregion

    //
    //  工厂集
    //
    #region

    /// <summary>
    /// 中国农业银行数据解密操作(解密23磁道）
    /// </summary>
    public class DecryptCoreZGNYYHfactory : AbstractDecrypt
    {
        public override DecryptCoreF CreateCore<T>(T _context)
        {
            Context context = (Context)(Object)_context;
            return new DecryptCoreZGNYYH(context);
        }
    }
    #endregion


    //
    //  简单工厂
    //
    #region

    /// <summary>
    /// 解密简单工厂
    /// </summary>
    public class setDecryptCoreFactory
    {
        public DecryptCoreF CreateFactory<T>(string whichFactory, T config)
        {
            switch (whichFactory)
            {
                case "NYYH23Track":
                    return new DecryptCoreZGNYYHfactory().CreateCore(config);
                default:
                    break;
            }
            return null;
        }
    }
    #endregion
}
